package com.linkoog.devtools.hide_project_path.persistent;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@State(name = "hide-project-path", storages = @Storage("hide-project-path.xml"))
public class ShowProjectPathSettings implements PersistentStateComponent<ShowProjectPathSettings> {

    public static ShowProjectPathSettings getInstance(@NotNull Project project) {
        return project.getService(ShowProjectPathSettings.class);
    }

    private boolean showProjectPath = true;

    @Nullable
    @Override
    public ShowProjectPathSettings getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull ShowProjectPathSettings state) {
        this.showProjectPath = state.showProjectPath;
    }

    public boolean isShowProjectPath() {
        return showProjectPath;
    }

    public void setShowProjectPath(boolean showProjectPath) {
        this.showProjectPath = showProjectPath;
    }
}
